package com.easyj.base.security.filter;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.config.annotation.SecurityConfigurerAdapter;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.web.DefaultSecurityFilterChain;
import org.springframework.security.web.context.SecurityContextPersistenceFilter;
import org.springframework.stereotype.Component;


/**
 * Authentication 组装filter config
 */
@Component
public class JCacheAuthenticationTokenSecurityConfig extends SecurityConfigurerAdapter<DefaultSecurityFilterChain, HttpSecurity> {
    @Autowired
    private JCacheAuthenticationTokenFilter jAuthenticationTokenFilter;

    @Override
    public void configure(HttpSecurity http) throws Exception {
        // 注入过滤器
        http.addFilterAfter(jAuthenticationTokenFilter, SecurityContextPersistenceFilter.class);
    }
}